﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HFController;

namespace HFWebApp.Control
{
    public partial class c_NewsClass4 : System.Web.UI.UserControl
    {
        public BagePages bg = new BagePages();
        /// <summary>
        /// 如果是0，表示一般的按照专题绑定，如果是1，就是全部
        /// </summary>
        public int TypeID { get; set; }
        /// <summary>
        /// 显示数量
        /// </summary>
        public int Count { get; set; }
        /// <summary>
        /// 专题ID
        /// </summary>
        public int TopicID { get; set; }
        /// <summary>
        /// 剪切新闻数量
        /// </summary>
        public int CuteStrCount { get; set; }
        /// <summary>
        /// 剪切新闻内容数量
        /// </summary>
        public int CuteContentStrCount { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (TypeID == 1)
                {
                    rpt_isTopList.DataSource = NewsController.getController().getNewsList(1, "isTop=1");
                    rpt_list.DataSource = NewsController.getController().getNewsList(Count, "");
                }
                else {
                    rpt_isTopList.DataSource = NewsController.getController().getNewsList(1, "TopicID=" + TopicID.ToString() + " and isTop=1");
                    rpt_list.DataSource = NewsController.getController().getNewsList(Count, "TopicID=" + TopicID.ToString());
                }
                rpt_isTopList.DataBind();
                rpt_list.DataBind();
            }
        }

        public string bClassName(string ID)
        {
            hf.Model.LegalAffairsBiglClass bClassModel = LegalAffairsController.getController().getLegalAffairsBiglClassModel(int.Parse(ID));
            if (bClassModel == null)
            {
                return "分类错误";
            }
            else
            {
                return LegalAffairsController.getController().getLegalAffairsBiglClassModel(int.Parse(ID)).ClassName;
            }
        }
    }
}